<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">搜索github用户</h3>
    <div>
      <input
        type="text"
				v-model="keyword"
        placeholder="输入用户名"
      />&nbsp;
			<button @click="search">搜索</button>
    </div>
  </section>
</template>

<script>
	import axios from 'axios'

	export default {
		name: "Search",
		data() {
			return {
				keyword:''
			}
		},
		methods: {
			async search(){
				const result = await axios.get(`https://api.github.com/search/users?q=${this.keyword}`)
				this.$bus.$emit('get-users',result.data.items)
			}
		},
	};
</script>
